import { getDetail } from "@/api/erp/erpGradeRule";

export async function getCode(code) {
    return await getDetail({ code: code }).then(res => {
        if (res.code == 200) {
            return codeStyle(res.data.codingRule)
        } else {
            // this.$message.warning(res.message);
        }
    });
};
//处理编码规则样式
function codeStyle(code) {
    let codeText = "";
    for (let i = 0; i < code.length; i++) {
        let codeNum = code.substring(i, i + 1);
        for (let index = 0; index < codeNum; index++) {
            codeText += "*";
        }
        codeText += " ";
    }
    return codeText;
};

